<template>
	<view>
		<!-- 头部背景 -->
		<view class="headCss"></view>

		<!-- 控制面板 -->
		<view class="headText">
			<view class="divText1">核销码 {{code}}</view>
			<!-- 分割线 -->
			<view class="div-line" />
			<!-- 服务内容 -->
			<view class="serve-order">
				<text>
					服务内容
				</text>
				<text>{{serveName}}</text>
				<text v-for="(item,index) in serve" :key="index">{{item}}</text>
				<text>（{{serveRemark}}）</text>
			</view>
			<!-- 分割线 -->
			<view class="div-line" />
			<view class="serve-order">
				<text>
					订单信息
				</text>
				<text>订单价格：￥{{orderPrice}}</text>
				<text>实付金额：<text style="display: inline; font-weight: bold;">￥{{payPrice}}</text></text>
				<text>优惠金额：￥{{preferentialPrice}}</text>
				<text>订单编号：{{orderId}}</text>
				<text>支付时间：{{payTime}}</text>
				<text>预约时间：{{appointmentTime}}</text>
			</view>
		</view>

		<button v-if="!isUserd" type="primary" @click="dialogToggle('info')"
			style="width: 80%; border-radius: 60rpx; margin-top: 40rpx;">确认核销</button>
		<!-- 关键修改：添加 background-color 和 :disabled="true" -->
		<button v-else
			style="width: 80%; border-radius: 60rpx; margin-top: 40rpx; background-color: #808080; color: #fff;"
			:disabled="true">
			已核销
		</button>

		<view>
			<!-- 提示窗示例 -->
			<uni-popup ref="alertDialog" type="dialog">
				<uni-popup-dialog type="info" cancelText="取消" confirmText="确认" title="核销此订单"
					content="请您仔细核对订单，此操作不可撤销，请谨慎操作!" @confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
			</uni-popup>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isUserd: false,
				code: 'MC1234-5678-9012',
				serveName: "XXX标准洗车服务包含",
				serve: [
					"整车泡沫冲洗擦T",
					"轮胎轮毂冲洗清洁",
					"车内吸尘",
					"内饰脚垫简单除尘"
				],
				serveRemark: "不包含虫蛀、水泥、沥青和顽固污渍清理等",

				orderPrice: 30.00, // 订单金额
				payPrice: 25.00, // 实付金额
				preferentialPrice: 5.00, // 优惠金额
				orderId: 2025090510434893849, // 订单编号
				payTime: "2025-03-25 10:00:00", // 支付时间
				appointmentTime: "2025-03-25 14:00:00", // 预约时间
			}
		},

		methods: {
			dialogToggle(type) {
				this.$refs.alertDialog.open(this.type)
			},
			dialogConfirm() {
				console.log('点击确认')
				this.isUserd = true
			},
			dialogClose() {
				console.log('点击关闭')
			},
		}
	}
</script>

<style scoped>
	.headCss {
		background-color: #3385fd;
		width: 750rpx;
		height: 300rpx;
		position: fixed;
	}

	.headText {
		background-color: #fff;
		border-radius: 20rpx;
		width: 710rpx;
		min-height: 400rpx;
		margin-left: 20rpx;
		position: relative;
	}

	.divText1 {
		text-align: center;
		font-size: larger;
		padding-top: 20rpx;
	}



	/* 分割线 */
	.div-line {
		width: 670rpx;
		margin: 20rpx 20rpx 20rpx 20rpx;
		height: 10rpx;
		background-color: #f7f7f7;
		border-radius: 10rpx;
	}

	.serve-order>text {
		display: block;
		padding: 10rpx 10rpx 10rpx 20rpx;
	}

	.serve-order>text:nth-child(1) {
		font-size: large;
		font-weight: bold;
	}

	.serve-order>text:last-child {
		padding-bottom: 20rpx;
	}
</style>